package multidraw.util;

import java.io.File;
import java.io.Serializable;

import multidraw.tools.ToolInfo;

public class ToolArchive implements Serializable {
	public ToolInfo toolInfo;
	public byte[] data;
	
	public ToolArchive(ToolInfo info, byte[] data) {
		this.toolInfo = info;
		this.data = data;
	}
	
	public static ToolArchive buildToolArchive(ToolInfo info) {
		//build the zip archive of the selected tool
		try {
			byte[] archive = Zip.zipDirectoryToByteArray(new File("tools", info.toolName));
			return new ToolArchive(info, archive);
		} catch (Exception e) {
			System.out.println(e);
		}
		return null;
	}
}
